import { axios } from '@/utils/request'
import config from '@/config/appConfig'
import querystring from 'querystring'
  
export function add (parameter) {
  return axios({
    url: config.url,
    method: 'get',
    params: {
      _gp: 'admin.finance',
      _mt: 'bindAccount',
      ...parameter
    }
  })
}

export function getAccountList (userId) {
    return axios({
      url: config.url,
      method: 'get',
      params: {
        _gp: 'admin.finance',
        _mt: 'queryAccount',
        userId
      }
    })
  }

  export function unBind (accountNo) {
    return axios({
      url: config.url,
      method: 'get',
      params: {
        _gp: 'admin.finance',
        _mt: 'unBindAccount',
        accountNo
      }
    })
  }

  export function getBasicList (parameter) {
    return axios({
      url: config.url,
      method: 'get',
      params: {
        _gp: 'admin',
        _mt: 'info',
        ...parameter
      }
    })
  }

  export function amendList (parameter) {
    let adminDTO = JSON.stringify(parameter)
    
    return axios({
      url: config.url,
      method: 'post',
      headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
      data: querystring.stringify({
        _gp: 'admin',
        _mt: 'update',
        adminDTO:adminDTO
      })
    })
  }